package com.aaron.study.customer.feign;

import java.util.List;

import com.aaron.study.common.config.KeFuFeignConfig;
import org.springframework.cloud.netflix.feign.FeignClient;

import com.aaron.study.common.entity.TextMessage;

import feign.RequestLine;

/**
 * 与客服服务通讯 <br>
 * Date: 2018/1/22 <br>
 * Time: 23:53 <br>
 *
 * <a href="https://gitee.com/aaronsd/spring-cloud-security/">spring-cloud-security</a>
 *
 * @author <a href="mailto:610195979@qq.com?subject=com.aaron.study.spring-cloud-security">aaron</a>
 * @version 0.0.1
 */
@FeignClient(name = "kefu", fallback = KeFuClientFallBack.class, configuration = KeFuFeignConfig.class)
public interface KeFuFeignClient {

	/**
	 * 将收到的客户消息转发给客服<br>
	 * 1. 不定义feignContract时两种注解方式: <br>
	 * RequestMapping(value = "/receive/textMessage", method = RequestMethod.POST)<br>
	 * PostMapping("/receive/textMessage")<br>
	 * 参数必须加@RequestBody注解<br>
	 * 
	 * 2. 定义feignContract时: @RequestLine("POST /receive/textMessage")，参数不加注解
	 * 
	 * @param textMessage
	 *        textMessage
	 * @return textMessage 客服发给客户的消息
	 */
	@RequestLine("POST /textMessage")
	TextMessage send2Kefu(TextMessage textMessage);

	/**
	 * 获取在线的客服列表
	 *
	 * @return list of kefu
	 */
	@RequestLine("GET /online/kefu")
	List<String> getKeFu();
}
